home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14966 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: char* still alive after free ???
  5. Date: 16 Apr 1996 07:36:39 -0500
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4l048n$g3u@solutions.solon.com>
  8. References: <317269EA.11BB93C2@studbox.uni-stuttgart.de> <829591931snz@genesis.demon.co.uk> <4kvgb4$3vt@nervous.pdb.sni.de>
  9. Reply-To: seebs@solon.com
  10. NNTP-Posting-Host: solutions.solon.com
  11.  
  12. In article <4kvgb4$3vt@nervous.pdb.sni.de>,
  13. Josef Moellers  <mollers.pad@sni.de> wrote:
  14. >In <829591931snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk> writes:
  15.  
  16. >>>free(text); text=NULL; and finally a
  17.  
  18. >>The text = NULL; is redundant.
  19.  
  20. >It's NOT redundant! It would be if "free(text)" would set "text" to
  21. >NULL, but since arguments are passed by value in C, this is unlikely.
  22.  
  23. There's an implementation where it does, apparently.
  24.  
  25. The reason he said it was redundant is that the very next line of the
  26. original code assigned to text; two successive assignments can safely
  27. be assumed redundant, if the variable assigned to isn't volatile.
  28.  
  29. -s
  30. -- 
  31. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  32. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  33. Unsolicited email is not welcome, and will be billed for at consulting rates.
  34. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  35.